package com.example.shop.goods.dto;

import com.example.shop.pojo.Comments;
import com.fasterxml.uuid.Generators;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;

import javax.validation.constraints.NotNull;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class CommentInfoParam extends EvaluationBase{
    @NotNull
    private Long evaluationId;

    public Comments toComment(){
        Comments comments = new Comments();
        //评论id：根据时间生成UUID
        comments.setCommentsId(Generators.timeBasedGenerator().generate().node());
        comments.setEvaluationId(evaluationId);
        comments.setCommentsContent(content);
        return comments;
    }
}
